import request from "@/utils/request";

// 查询部门列表
export function devicetypeList(query) {
  return request({
    url: "/pk-iot/iot/devicetype/list",
    method: "get",
    params: query,
  });
}

export function devicetypeDel(jobId) {
  return request({
    url: "/pk-iot/iot/devicetype/delete",
    method: "delete",
    data: jobId,
  });
}

export function adddevicetype(data) {
  return request({
    url: "/pk-iot/iot/devicetype/save",
    method: "post",
    data: data,
  });
}
export function updatedevicetype(data) {
  return request({
    url: "/pk-iot/iot/devicetype/update",
    method: "put",
    data: data,
  });
}
export function devicemodelList(query) {
  return request({
    url: "/pk-iot/iot/devicemodel/list",
    method: "get",
    params: query,
  });
}

export function devicemodelDel(ids) {
  return request({
    url: "/pk-iot/iot/devicemodel/delete",
    method: "delete",
    data: ids,
  });
}

export function supplierList(query) {
  return request({
    url: "/pk-iot/iot/supplier/list",
    method: "get",
    params: query,
  });
}

export function adddevicemodel(data) {
  return request({
    url: "/pk-iot/iot/devicemodel/save",
    method: "post",
    data: data,
  });
}
export function updatedevicemodel(data) {
  return request({
    url: "/pk-iot/iot/devicemodel/update",
    method: "put",
    data: data,
  });
}

export function getGatewayList() {
  return request({
    url: "/pk-iot/iot/devicemodel/getGatewayList",
    method: "get",
  });
}

export function deviceregList(query) {
  return request({
    url: "/pk-iot/iot/devicereg/list",
    method: "get",
    params: query,
  });
}

export function deviceregDel(ids) {
  return request({
    url: "/pk-iot/iot/devicereg/delete",
    method: "delete",
    data: ids,
  });
}

export function adddevicereg(data) {
  return request({
    url: "/pk-iot/iot/devicereg/save",
    method: "post",
    data: data,
  });
}
export function updatedevicereg(data) {
  return request({
    url: "/pk-iot/iot/devicereg/update",
    method: "put",
    data: data,
  });
}

export function getDeviceBaseInfo(deviceModel, id) {
  return request({
    url: `/pk-iot/iot/devicereg/get-device-basic-info/${deviceModel}/${id}`,
    method: "get",
  });
}
export function getDeviceBasicInfo(deviceModel, id) {
  return request({
    url: `/pk-iot/iot/devicereg/get-device-basic-info/${deviceModel}/${id}`,
    method: "get",
  });
}

export function getgetTerminalAlertInfo(id) {
  return request({
    url: `/pk-iot/iot/devicereg/get-terminal-alert-info/${id}`,
    method: "get",
  });
}

export function getgetBedBeltStatusInfo(id) {
  return request({
    url: `/pk-iot/iot/devicereg/get-bed-belt-status-info/${id}`,
    method: "get",
  });
}
export function getSleepReportPie(id, date) {
  return request({
    url: `/pk-iot/iot/devicereg/get-sleep-report-pie/${id}/${date}`,
    method: "get",
  });
}
export function getSleepReportBar(id, date) {
  return request({
    url: `/pk-iot/iot/devicereg/get-sleep-report-bar/${id}/${date}`,
    method: "get",
  });
}

export function getTerminalAlertInfo(deviceModel, id) {
  return request({
    url: `/pk-iot/iot/devicereg/get-terminal-alert-info/${deviceModel}/${id}`,
    method: "get",
  });
}
export function getHealthIndex(id) {
  return request({
    url: `/pk-iot/iot/devicereg/get-health-index/${id}`,
    method: "get",
  });
}

// 打开即时报警的弹框时，根据imei和设备类型来获取表格数据
export function getDeviceTypeAlertData(data) {
  return request({
    url: "/pk-iot/iot/devicereg/get-terminal-alert-data-by-alarm-type",
    method: "get",
    params: data,
  });
}

// 打开健康指标弹框时，根据imei和指标来获取表格数据
export function getIndexTableData(data) {
  return request({
    url: "/pk-iot/iot/devicereg/getIndexData",
    method: "get",
    params: data,
  });
}

//
// // 新增部门
// export function addDept(data) {
//     return request({
//         url: '/system/dept',
//         method: 'post',
//         data: data
//     })
// }
//
//
// // 删除部门
// export function delDept(deptId) {
//     return request({
//         url: '/system/dept/' + deptId,
//         method: 'delete'
//     })
// }
